package com.test.mytest.registry;
import java.util.prefs.*;
public class Registery {
    String[] keys = {"version", "initial", "creator"};
    String[] values = {"1.3", "ini.mp3", "caokai1818@sina.com"};
    //把相应的值储存到变量中去
    public void writeValue() {
    	// HKEY_LOCAL_MACHINE\Software\JavaSoft\prefs下写入注册表值.
    	Preferences systemNodeForPackage = Preferences.systemNodeForPackage(this.getClass());
    	System.out.println(Preferences.systemRoot());
    	Preferences userRoot = Preferences.userRoot();
    	System.out.println(userRoot);
        Preferences pre = Preferences.systemRoot().node("/javaplayer");
        
        for (int i = 0; i < keys.length; i++) {
            pre.put(keys[i], values[i]);
        }
    }
    public static void main(String[] args) {
        Registery reg = new Registery();
        reg.writeValue();
    }
}
